#pragma once


#include <direct.h>


#include "Demo_00_TestCode.h"
#include "Demo_01_ColorSpace.h"
#include "Demo_02_MatCreation.h"
#include "Demo_03_PixelVisit.h"
#include "Demo_04_Operators.h"
#include "Demo_05_BarControl.h"
#include "Demo_06_KeyControl.h"
#include "Demo_07_ChannelFilter.h"
#include "Demo_08_GeometryDraw.h"
#include "Demo_09_MouseControl.h"
#include "Demo_10_Transform.h"
#include "Demo_11_Video.h"
#include "Demo_12_Histogram.h"
#include "Demo_13_Blur.h"
#include "Demo_14_FaceDetection.h"


int run()
{

	// run();

	char *buffer; // Get the current working directory:  获得当前运行的路径
	{
		if ((buffer = _getcwd(NULL, 0)) == NULL)
			perror("_getcwd error");
		std::cout << "当前运行目录：" << buffer << std::endl;
	}
	std::string resDir; //当前资源目录
	{
		resDir = buffer;
		resDir += "/../../resource/";
		std::cout << "当前资源目录：" << resDir << std::endl;
	}
	std::string imgPath; //当前测试图片：
	{
		imgPath = resDir + "test_image.png";
		std::cout << "当前测试图片：" << imgPath << std::endl;
	}

	//清理保存路径的内存
	free(buffer);

	// imagePath图片的路径
	Mat src = imread(imgPath);

	//===================================
	//

	std::cout << imgPath << std::endl;
	//开始启用cv函数打开图片
	ReadAndShow_Demo(src);
	ReadAndShow_Demo(imgPath);

	//保存灰度图以及hsv图
	ColorSpace_Demo(src, resDir);
	//图片矩阵操作
	MatCreation_Demo(src);
	//对图像像素依次处理  获得图像反色操作
	PixelVisit_Demo(src);
	//对图像像素依次处理 指针操作 获得图像反色操作
	PixelVisitPtr_Demo(src);

	//...

	//面部识别  使用运算好的机器学习成果
	face_detection_demo(resDir + "/Megamind.avi", resDir + "/face_detector/");

	/*string ddxe = "J:\\EDU\\_文史哲\\温铁军 告别百年激进2019【2小时完整版】_超清 - 1.温铁军 告别百年激进2019【2小时完整版】_超清(Av883123103,P1).mp4";
	face_detection_demo(ddxe,resDir + "/face_detector/"  );*/

	//===================================

	return 0;
}
